import { timeFormat } from '../../model/utils/common';

export default {
    namespace: 'tipDetail',
    state: {
        detail: {}
    },
    reducers: {
        save(state, { payload }) {
            return Object.assign({}, state, payload);
        }
    },
    effects: {
        /**
         * 获取我的tips列表
         * @param {*} param0 
         * @param {*} param1 
         */
        *init({ payload }, { put, call, select }){
            const tip = yield put.resolve({
                type : '$request/post',
                payload : {
                    url : '/api/getTipsDetail',
                    data: {
                        id: payload.id
                    }
                }
            });

            yield put({
                type : 'save',
                payload : {
                    detail: tip||{}
                }
            });
        }
    }
};